package com.hhf.cloud.entities;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 表名：dtx_storage_freeze
 */
@Table(name = "dtx_storage_freeze")
public class DtxStorageFreeze {
    @Id
    private String xid;

    /**
     * 产品id
     */
    @Column(name = "product_id")
    private Long productId;

    /**
     * 冻结数量
     */
    @Column(name = "freeze_amount")
    private Integer freezeAmount;

    /**
     * tcc事务状态，0:try，1:confirm，2:cancel
     */
    @Column(name = "tcc_status")
    private Integer tccStatus;

    /**
     * DDD设计思想：领域模型
     * TCC三大状态定义
     */
    public static abstract class TccStatusEnum {
        public static final int TRY = 0;
        public static final int CONFIRM = 1;
        public static final int CANCEL = 2;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    /**
     * @return xid
     */
    public String getXid() {
        return xid;
    }

    /**
     * @param xid
     */
    public void setXid(String xid) {
        this.xid = xid;
    }


    /**
     * 获取冻结数量
     *
     * @return freezeAmount - 冻结数量
     */
    public Integer getFreezeAmount() {
        return freezeAmount;
    }

    /**
     * 设置冻结数量
     *
     * @param freezeAmount 冻结数量
     */
    public void setFreezeAmount(Integer freezeAmount) {
        this.freezeAmount = freezeAmount;
    }

    /**
     * 获取tcc事务状态，0:try，1:confirm，2:cancel
     *
     * @return tccStatus - tcc事务状态，0:try，1:confirm，2:cancel
     */
    public Integer getTccStatus() {
        return tccStatus;
    }

    /**
     * 设置tcc事务状态，0:try，1:confirm，2:cancel
     *
     * @param tccStatus tcc事务状态，0:try，1:confirm，2:cancel
     */
    public void setTccStatus(Integer tccStatus) {
        this.tccStatus = tccStatus;
    }
}
